package cn.donting.jme.edit.ui.scenetree.meum;

import cn.donting.jme.edit.EditorState;
import cn.donting.jme.edit.project.Project;
import cn.donting.jme.edit.ui.scenetree.ClipBoard;
import cn.donting.jme.edit.ui.scenetree.SceneTreeNodeView;
import cn.donting.jme.edit.ui.scenetree.SpatialTreeItem;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import javafx.event.ActionEvent;
import javafx.scene.input.MouseEvent;

public class CopyMenuItem extends AbsTreeMenuItem {
    public CopyMenuItem() {
        super("复制");
    }

    @Override
    public boolean isAvailable(ClipBoard clipBoard) {
        SceneTreeNodeView instance = SceneTreeNodeView.getInstance();
        Spatial selectSpatial = instance.getSelectSpatial();
        Node rootNode = EditorState.getJmeEditSceneApp().getRootNode();
        if (selectSpatial==null||selectSpatial.getParent()==rootNode) {
            return false;
        }
        return true;
    }



    @Override
    public void action(ClipBoard clipBoard) {
        Spatial selectSpatial = clipBoard.getSelectSpatial();
        clipBoard.setCopy(selectSpatial);
    }
}
